//
//  EightFoodwCell.m
//  DongChiDaChiProject1
//
//  Created by lanou3g on 15/10/27.
//  Copyright © 2015年 com.lanou3g. All rights reserved.
//

#import "EightFoodwCell.h"
#import "EightFoodwCell.h"

@implementation EightFoodwCell

- (void)awakeFromNib {
    // Initialization code
}
// 重写方法
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        //self.backgroundColor = [UIColor lightGrayColor];
        // 调用方法
        self.backgroundColor = [[UIColor orangeColor]colorWithAlphaComponent:0.3];
        [self addSubViews];
    }
    return self;
}
//在这里布局子视图
- (void)addSubViews
{
    
    // 设置大背景
    UIView *backGroundView = [[UIView alloc] initWithFrame:CGRectMake(0, 3, kScreenWidth, (kScreenHeight / 4 + 40) * kWidthFitParameter)];
    backGroundView.layer.cornerRadius = 2 * kWidthFitParameter;
    backGroundView.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:backGroundView];
    // 设置图片
    self.imageBackPicture = [[UIImageView alloc] initWithFrame:CGRectMake(20 * kWidthFitParameter, 5 * kWidthFitParameter, kScreenWidth - 40 * kWidthFitParameter, (kScreenHeight / 4  + 30 )* kWidthFitParameter)];
    self.imageBackPicture.layer.cornerRadius = 10 * kWidthFitParameter;
    self.imageBackPicture.layer.masksToBounds = YES;
    self.imageBackPicture.backgroundColor = [UIColor orangeColor];
    [ backGroundView addSubview:self.imageBackPicture];

    
    // 设置类目
    self.categoryLable = [[UILabel alloc] initWithFrame:CGRectMake(10 * kWidthFitParameter, (self.imageBackPicture.bottom - 30) * kWidthFitParameter, (self.imageBackPicture.width - 20 )* kWidthFitParameter, 20 * kWidthFitParameter)];
    //self.categoryLable.backgroundColor = [UIColor whiteColor];
    [self.imageBackPicture addSubview:self.categoryLable];
    
    // 设置标题
    self.titleLable = [[UILabel alloc] initWithFrame:CGRectMake(10 * kWidthFitParameter, (self.categoryLable.top - 30) * kWidthFitParameter, (self.imageBackPicture.width - 20 )* kWidthFitParameter, 25 * kWidthFitParameter)];
   // self.titleLable.backgroundColor = [UIColor greenColor];
    [self.imageBackPicture addSubview:self.titleLable];
    
    // 设置菜系
    self.caixiLable = [[UILabel alloc] initWithFrame:CGRectMake(10 * kWidthFitParameter, 10 * kWidthFitParameter, 60 * kWidthFitParameter, 40 * kWidthFitParameter)];
    self.caixiLable.textColor = [UIColor orangeColor];
    self.caixiLable.font = [UIFont systemFontOfSize:18 * kWidthFitParameter];
   // self.caixiLable.backgroundColor = [UIColor whiteColor];
    [self.imageBackPicture addSubview:self.caixiLable];
    
   
}
// 赋值
- (void)setModel:(EightFoodModel *)model
{
    // 大背景片赋值
    [self.imageBackPicture sd_setImageWithURL:[NSURL URLWithString:model.thumb_2] placeholderImage:[UIImage imageNamed:@"placehoder.jpg"]];
    // 目录赋值
    self.categoryLable.text = [NSString stringWithFormat:@"%@", model.category];
    // 标题赋值
    self.titleLable.text = [NSString stringWithFormat:@"%@", model.title];
    
   
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
